package ru.alt22.visor.php.core.codegen;

import java.util.ArrayList;

public class PHPFile {

	private ArrayList<PHPFileEntry> entries;

	public PHPFile() {
		entries = new ArrayList<PHPFileEntry>();
	}

	public void addEntry(PHPFileEntry entry) {
		entries.add(entry);
	}

	public String toString() {
		StringBuffer result = new StringBuffer();

		result.append("<?php\n");
		result.append("\n");
		for (int i = 0; i < entries.size(); i++) {
			PHPFileEntry entry = (PHPFileEntry) entries.get(0);
			result.append(entry.toString(1));
			result.append("\n");
		}
		result.append("?>");

		return result.toString();
	}

}